package com.wenx.v3system.modular.cloud.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wenx.v3system.modular.cloud.domain.po.SysDepartmentUser;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 系统部门用户Mapper接口
 */
@Mapper
public interface SysDepartmentUserMapper extends BaseMapper<SysDepartmentUser> {
    
    /**
     * 物理删除用户部门关联（绕过逻辑删除）
     * @param userId 用户ID
     * @return 删除记录数
     */
    @Delete("DELETE FROM sys_department_user WHERE user_id = #{userId}")
    int physicalDeleteByUserId(@Param("userId") Long userId);
    
    /**
     * 物理删除部门用户关联（绕过逻辑删除）
     * @param departmentId 部门ID
     * @return 删除记录数
     */
    @Delete("DELETE FROM sys_department_user WHERE department_id = #{departmentId}")
    int physicalDeleteByDepartmentId(@Param("departmentId") Long departmentId);
}